package daily.nov;

import java.util.Arrays;

public class lc717 {
    public boolean isOneBitCharacter(int[] bits) {
        int len = bits.length;
        int last = bits[len - 1];
        int[] last5 = new int[5];
        for (int i = len-5; i < len; i++) {//获取bits中的最后5位子数组
            for (int j = 0; j < 5; j++) {
                last5[j] = bits[i];
            }
        }

        int[] special = {0,1,1,1,0};//返回结果为false的唯一一种特殊情况

        if (last == 1){
            return false;
        }else if (Arrays.equals(last5, special)){
            return false;
        }else {
            return true;
        }
    }

    public static void main(String[] args) {
        lc717 lc = new lc717();
        int[] bits1 = {1,0,0};
        System.out.println(lc.isOneBitCharacter(bits1));
        int[] bits2 = {1,1,1,0};
        System.out.println(lc.isOneBitCharacter(bits2));
    }
}
